-
Notifications
You must be signed in to change notification settings - Fork 6
Issue #41: Updated headerTest to use AbstractRecipeTestSupport #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@rdiachenko sourceFile = sourceFile.withPrefix(
Space.format(fixedHeader + System.lineSeparator()));format method treats \r and \n as separate values, therefore it fails in windows where Will raise a separate PR for fix, i tried replicating the issue with |
bfa346c to
5a55f28
Compare
|
Let's step back. Why do we need Additionally, could you resolve conflicts please |
@rdiachenko its necessary so that the code after the header starts from its own line. Although IMO in the existing code there are two issues(bugs) that balances out.
protected static String readFile(String filename) throws IOException {
return toLfLineEnding(Files.readString(Path.of(filename)));
}
protected static String toLfLineEnding(String text) {
return text.replaceAll("(?x)\\\\r(?=\\\\n)|\\r(?=\\n)", "");
}to convert Windows-style line endings (\r\n) to Unix-style line endings (\n). |
|
@rdiachenko |
e52a3c0 to
3d3b783
Compare
|
@rdiachenko Done. |
src/test/java/org/checkstyle/autofix/recipe/AbstractRecipeTestSupport.java
Show resolved
Hide resolved
3d3b783 to
9b29855
Compare
rdiachenko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Part of: #41
Updated
HeaderTestto extendAbstractRecipeTestSupport.